<layout name="page" />
<block name="content">
	<input type="hidden" id="ajax" name="ajax" value="0">
	{:widget('page_header/simple',array('name'=>'编辑文档','search'=>'N'))}
	<div class="row frame">
		<form method='post' id="form_data" name="form_data" enctype="multipart/form-data">
			<input type="hidden" id="id" name="id" value="{$vo.id}">
			<input type="hidden" id="opmode" name="opmode" value="edit">
			<div class="box">
				<label class="input-label" for="name">文件名*：</label>
				<input class="input" type="text" id="name" name="name" check='required' info='请输入文件名' value="{$vo.name}">
			</div>
			<div class="box">
				<label class="input-label">内容：</label>
				<textarea class="editor" id="content" name="content" style="width:100%;height:300px;" check="required" info="请输入内容">{$vo.content}</textarea>
			</div>
			<div class="box">
				<label class="input-label" for="name">附件：</label>
				{:widget('file_upload/edit',array('add_file'=>$vo['add_file']))}
			</div>
			<div class="box">
				<label class="input-label"></label>
				<a class="btn btn-normal" onclick="save();">保存</a>
				<a class="btn btn-return" onclick="go_return_url();">取消</a>
			</div>
		</form>
	</div>
</block>
<block name="js">
	<script type="text/javascript">
		layui.use(['global', 'uploader', 'editor'], function() {
			var $ = layui.jquery;
			var fn = {
				save : function() {
					send_form("form_data", "{:url('save')}", "{:url('index')}", function(ret) {
						if (ret.status) {
							layer.msg(ret.info, {
								time : 1200
							}, function() {
								location.reload(true);
							});
						} else {
							layer.msg(ret.info);
							return false;
						}
					});
				},
			};
			win_exp(fn);
		});
	</script>
</block>